      SUBROUTINE BAYLIS(Q,MAXO1)
c
c23456789012345678901234567890123456789012345678901234567890123456789012
c
C    BAYLIS RETURNS THE COEFFICIENTS FOR RKS INTEGRATION.
C    SEE E. BAYLIS SHANKS(1966 A. M. S.) AND REFERENCES THEREIN FOR THE
C    COEFFICIENTS. THE EIGHT RUNGE-KUTTA-SHANKS FORMULAE ARE (1-1) (2-2)
C    (3-3) (4-4) (5-5) (6-6) (7-7) (8-10). FOR ORDERS GREATER THAN 4 THE
C    FORMULAE ARE APPROXIMATE RATHER THAN EXACT SO INCURRING LESS ROUNDOFF.
c
c    calls no other routines
c
      IMPLICIT REAL*8(A-H,O-Z)
c
      SAVE
      COMMON/SHANKS/B(46),C(10),DX,STEP(8),STEPF,I,MAXO
c
      DS=Q*DABS(DX)
      DO 10 J=1,MAXO1
      IF(DS.GT.STEP(J)) GO TO 10
      I=J
      GO TO 15
   10 CONTINUE
      I=MAXO
   15 C(1)=0.D0
      GO TO (1,2,3,4,5,6,7,8),I
    1 B(1)=DX
      RETURN
c
    2 C(2)=DX
      B(1)=DX
      B(2)=.5D0*DX
      B(3)=1.D0
      RETURN
c
    3 C(2)=.5D0*DX
      C(3)=DX
      B(1)=C(2)
      B(2)=-DX
      B(3)=-2.D0
      B(4)=.16666666666667D0*DX
      B(5)=4.D0
      B(6)=1.D0
      RETURN
c
    4 C(2)=.01D0*DX
      C(3)=.6D0*DX
      C(4)=DX
      B(1)=C(2)
      B( 2)=-.17461224489790D+02*DX
      B( 3)=-.10343618513324D+01
      B( 4)= .59691275167780D+02*DX
      B( 5)=-.10140620414448D+01
      B( 6)= .30814908546230D-01
      B( 7)=-.25555555555556D+01*DX
      B( 8)=-.11165449632656D+01
      B( 9)=-.22568165070006D+00
      B(10)=-.49077733860351D-01
      RETURN
c
    5 C( 2)= 1.1111111111111D-04*DX
      C( 3)= 3.0D-01*DX
      C( 4)= 7.5D-01*DX
      C( 5)= DX
      B( 1)=C(2)
      B( 2)=-.40470000000000D+03*DX
      B( 3)=-.10007412898443D+01
      B( 4)= .25301250000000D+04*DX
      B( 5)=-.10004446420631D+01
      B( 6)= .74107010523195D-03
      B( 7)=-.11494333333333D+05*DX
      B( 8)=-.10004929965491D+01
      B( 9)= .52629261224803D-03
      B(10)=-.12029545422812D-03
      B(11)= .92592592592593D-01*DX
      B(12)= .00000000000000D+00
      B(13)= .47619047619048D+01
      B(14)= .42666666666667D+01
      B(15)= .77142857142857D+00
      RETURN
c
    6 C(2)=3.3333333333333D-03*DX
      C(3)=.2D0*DX
      C(4)=.6D0*DX
      C(5)=9.3333333333333D-01*DX
      C(6)=DX
      B( 1)=C(2)
      B( 2)=-.58000000000000D+01*DX
      B( 3)=-.10344827586207D+01
      B( 4)= .64600000000000D+02*DX
      B( 5)=-.10216718266254D+01
      B( 6)= .30959752321982D-01
      B( 7)=-.62975802469136D+03*DX
      B( 8)=-.10226149961576D+01
      B( 9)= .24906685695466D-01
      B(10)=-.37737402568887D-02
      B(11)=-.54275714285714D+04*DX
      B(12)=-.10225567867765D+01
      B(13)= .25375487829097D-01
      B(14)=-.31321559234596D-02
      B(15)= .12921040478749D-03
      B(16)= .53571428571429D-01*DX
      B(17)= .00000000000000D+00
      B(18)= .61868686868687D+01
      B(19)= .77777777777778D+01
      B(20)= .40909090909091D+01
      B(21)=-.38888888888889D+00
      RETURN
c
    7 C(2)=5.2083333333333D-03*DX
      C(3)=1.6666666666667D-01*DX
      C(4)=.5D0*DX
      C(5)=DX
      C(6)=8.3333333333333D-01*DX
      C(7)=DX
      B( 1)=C(2)
      B( 2)=-.25000000000000D+01*DX
      B( 3)=-.10666666666667D+01
      B( 4)= .26166666666667D+02*DX
      B( 5)=-.10421204027121D+01
      B( 6)= .61228682966918D-01
      B( 7)=-.64500000000000D+03*DX
      B( 8)=-.10450612653163D+01
      B( 9)= .51262815703925D-01
      B(10)=-.77519379844961D-02
      B(11)=-.93549382716049D+02*DX
      B(12)=-.10450293206756D+01
      B(13)= .48394546673620D-01
      B(14)=-.11877268228307D-01
      B(15)=-.39590894094358D-03
      B(16)= .35111904761905D+03*DX
      B(17)=-.10446476812124D+01
      B(18)= .52479782656724D-01
      B(19)=-.71200922221468D-02
      B(20)=-.61029361904114D-03
      B(21)= .27463212856852D-02
      B(22)= .46666666666667D-01*DX
      B(23)= .57857142857143D+01
      B(24)= .78571428571429D+01
      B(25)= .00000000000000D+00
      B(26)= B(23)
      B(27)= .10000000000000D+01
      RETURN
c
    8 C(2)=.14814814814815D0*DX
      C(3)=.22222222222222D0*DX
      C(4)=.33333333333333D0*DX
      C(5)= .5D0*DX
      C(6)=.66666666666667D0*DX
      C(7)=.16666666666667D0*DX
      C(8)=DX
      C(9)=.83333333333333D0*DX
      C(10)=DX
      B( 1)=C(2)
      B( 2)= .55555555555556D-01*DX
      B( 3)= .30000000000000D+01
      B( 4)= .83333333333333D-01*DX
      B( 5)= .00000000000000D+00
      B( 6)= .30000000000000D+01
      B( 7)= .12500000000000D+00*DX
      B( 8)= .00000000000000D+00
      B( 9)= .00000000000000D+00
      B(10)= .30000000000000D+01
      B(11)= .24074074074074D+00*DX
      B(12)= .00000000000000D+00
      B(13)=-.20769230769231D+01
      B(14)= .32307692307692D+01
      B(15)= .61538461538461D+00
      B(16)= .90046296296295D-01*DX
      B(17)= .00000000000000D+00
      B(18)=-.13881748071980D+00
      B(19)= .24832904884319D+01
      B(20)=-.21182519280206D+01
      B(21)= .62467866323908D+00
      B(22)=-.11550000000000D+02*DX
      B(23)=-.35064935064935D+00
      B(24)= .50389610389610D+01
      B(25)=-.28398268398268D+01
      B(26)= .52813852813853D+00
      B(27)=-.34632034632035D+01
      B(28)=-.44097222222222D+00*DX
      B(29)=-.14173228346457D+00
      B(30)= .53385826771654D+01
      B(31)=-.35905511811023D+01
      B(32)= .70866141732284D-01
      B(33)=-.45354330708661D+01
      B(34)=-.31496062992126D-01
      B(35)= .18060975609756D+01*DX
      B(36)=-.54692775151925D-01
      B(37)= .47967589466576D+01
      B(38)=-.22795408507765D+01
      B(39)= .48615800135044D-01
      B(40)=-.34031060094530D+01
      B(41)=-.40513166779204D-01
      B(42)= .48615800135044D+00
      B(43)= .48809523809524D-01*DX
      B(44)= .65853658536585D+00
      B(45)= .66341463414634D+01
      B(46)= .52682926829268D+01
      I=10
c
      RETURN
      END
